/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package search;

import env.Tile;

/**
 *
 * @author user
 */
public class HeuristicManhattan extends Heuristic {
    
    
     int dist_death() {
        int rowD = Math.abs(state.sentryState.getRow() - state.myState.getRow());
        int colD = Math.abs(state.sentryState.getCol() - state.myState.getCol()) / 2; // /2 cause it could be moving towards me...
        return Math.min(colD, rowD);
    }

    @Override
    int dist_farthest_flag() {
        int d = 0;
        Tile current = state.getTile();
        for (Tile flag : state.getFlags()) {
            int temp = flag.manhattan(current);
            if (temp > d) {
                d = temp;
            }
        }
        return d;
    }
    
//     private int dist_nearest_flag_manhattan() {
//        if (remaining == 0) {  //BUG FIX:  if it's 0, h1() will return MAX_VALUE
//            return 0;
//        }
//        int d = Integer.MAX_VALUE;
//        Tile current = state.getTile();
//        for (Tile flag : state.getFlags()) {
//            int temp = flag.manhattan(current);
//            if (temp < d) {
//                d = temp;
//            }
//        }
//        return d;
//    }
}
